package com.fyy.fastdfs.controller;

import com.fyy.fastdfs.utils.FdfsClientUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping("/file")
public class TestController {

    @Autowired
    private FdfsClientUtil fdfsClient;

    public String upload(@RequestParam("file") MultipartFile file) throws IOException {
        String filePath = fdfsClient.uploadFile(file);
        return filePath;
    }

}
